package com.itheima.d6_generics_class;

/*
public class MyArrayList {

    private Object[] arr = new Object[10];
    private int size; // 记录当前位置的，初始值为0
    public boolean add(Object e) {
        arr[size++] = e;
        return true;
    }

    public Object get(int index) {
        return arr[index];
    }
}
*/
public class MyArrayList<E> { //E element元素

    private Object[] arr = new Object[10];

    private int size; // 记录当前位置的，初始值为0

    public boolean add(E e) {
        arr[size++] = e;
        return true;
    }

    public E get(int index) {
        return (E) arr[index];
    }
}